import java.util.Comparator;
import java.util.HashMap;

/*
 * MyComparator.java
 * Author: GUannan ZHang
 * Usage: IR HW4: sort to find the top 5 features.
 */
public class MyComparator implements Comparator<Integer> {
	private HashMap<Integer, Double> features;
	public MyComparator(HashMap<Integer, Double> features) {
		this.features = features;
	}

	@Override
	public int compare(Integer o1, Integer o2) {
		if(features.get(o1) > features.get(o2))
			return -1;
		else if(features.get(o1) < features.get(o2))
			return 1;
		else
			return 0;
	}

}
